<!-- 设备管理-设备列表页面 -->
<template>
  <div class="app-container">
    <px-form v-show="showSearch" ref="queryRef" class="custom-form-ui" :model="queryParams" :inline="true" label-width="90px">
      <px-form-item label="系统">
        <px-select
          v-model="queryParams.systemCode"
          placeholder="请选择系统"
          clearable
          style="width: 240px"
          filterable
          @change="queysetSystemChemicals"
        >
          <px-option v-for="dict in liquidList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemValue" />
        </px-select>
      </px-form-item>
      <px-form-item label="化学品名称">
        <px-select v-model="queryParams.chemical" placeholder="请选择化学品名称" clearable style="width: 240px" filterable>
          <px-option v-for="dict in querychemicalList" :key="dict" :label="dict" :value="dict" />
        </px-select>
      </px-form-item>
      <px-form-item label="购买时间" style="width: 516px !important">
        <px-date-picker
          v-model="dateRange"
          type="datetimerange"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
          format="YYYY-MM-DD HH:mm:ss"
          value-format="YYYY-MM-DD HH:mm:ss"
          :default-time="defaultTime"
        />
      </px-form-item>
      <px-button style="margin-top: -17px" type="primary" icon="" @click="handleQuery('search')">搜索</px-button>
      <px-button style="margin-top: -17px" icon="" @click="resetQuery">重置</px-button>
    </px-form>

    <px-row :gutter="10" class="mb8">
      <px-col :span="1.5">
        <px-button v-has="'PRECURSOR_CHEMICALS_ADD'" type="primary" icon="" @click="handleAdd">新增</px-button>
      </px-col>
      <px-col :span="1.5">
        <px-button v-has="'PRECURSOR_CHEMICALS_EXPORT'" type="primary" plain icon="" @click="handleExport">导出报表</px-button>
      </px-col>
      <!-- <px-col :span="1.5">
        <px-button v-has="'CommonEquipListDelete'" type="danger" plain icon="" :disabled="multiple" @click="handleDelete">删除</px-button>
      </px-col> -->
    </px-row>

    <px-table
      v-if="!equipopen && !equipopenDetail"
      v-loading="loading"
      :data="typeList"
      height="calc(100vh - 329px)"
      show-overflow-tooltip
      border
      @selection-change="handleSelectionChange"
    >
      <!-- <px-table-column type="selection" width="40" /> -->
      <px-table-column label="序号" width="60" align="center" fixed="left">
        <template #default="{ $index }">
          {{ (queryParams.pageNum - 1) * queryParams.pageSize + $index + 1 }}
        </template>
      </px-table-column>
      <px-table-column label="系统" prop="systemName">
        <template #default="scope">
          <span>{{ scope.row.systemName ? scope.row.systemName : "-" }}</span>
        </template>
      </px-table-column>

      <px-table-column label="化学品名称" prop="chemical">
        <template #default="scope">
          <span>{{ scope.row.chemical ? scope.row.chemical : "-" }}</span>
        </template>
      </px-table-column>

      <px-table-column label="购买日期" width="160" prop="purchaseDate">
        <template #default="scope">
          <span>{{ scope.row.inboundDateFrom }}</span>
        </template>
      </px-table-column>

      <px-table-column label="购买数量" prop="purchaseQuantity">
        <template #default="scope">
          <span>{{ scope.row.purchaseQuantity ? scope.row.purchaseQuantity : "-" }}</span>
        </template>
      </px-table-column>
      <px-table-column label="单位" prop="chemicalUnit">
        <!-- <span>{{ scope.row.chemicalUnit ? scope.row.chemicalUnit : "-" }}</span> -->
        <span>吨</span>
      </px-table-column>
      <px-table-column label="销售单位" prop="salesCompany">
        <template #default="scope">
          <span>{{ scope.row.salesCompany ? scope.row.salesCompany : "-" }}</span>
        </template>
      </px-table-column>

      <px-table-column label="购买证明号" prop="purchaseProofNumber">
        <template #default="scope">
          <span>{{ scope.row.purchaseProofNumber ? scope.row.purchaseProofNumber : "-" }}</span>
        </template>
      </px-table-column>
      <px-table-column label="准购数量" prop="allowPurchaseQuantity">
        <template #default="scope">
          <span>{{ scope.row.allowPurchaseQuantity ? scope.row.allowPurchaseQuantity : "-" }}</span>
        </template>
      </px-table-column>
      <px-table-column label="购买证明有效期" width="190" prop="effectiveDate">
        <template #default="scope">
          <span>{{ scope.row.effectiveDateFrom }} - {{ scope.row.effectiveDateTo }}</span>
        </template>
      </px-table-column>
      <!-- <px-table-column label="入库单号" prop="externalInboundNumber">
        <template #default="scope">
          <span>{{ scope.row.externalInboundNumber ? scope.row.externalInboundNumber : "-" }}</span>
        </template>
      </px-table-column> -->
      <px-table-column label="出库状态" width="160" prop="outboundStatus">
        <template #default="scope">
          <span>{{ scope.row.outboundStatus }}</span>
        </template>
      </px-table-column>
      <px-table-column label="操作" align="center" width="240">
        <template #default="scope">
          <px-button v-has="'PRECURSOR_CHEMICALS_COPY'" link type="primary" @click="handleCopy(scope.row.id)">
            <px-tooltip class="box-item" content="复制" placement="top">
              <px-icon><CopyDocument /></px-icon> </px-tooltip
          ></px-button>
          <px-button v-has="'PRECURSOR_CHEMICALS_PUSH'" link type="primary" @click="handleDelivery(scope.row)">
            <px-tooltip class="box-item" content="出库" placement="top">
              <p><Chuku /></p> </px-tooltip
          ></px-button>
          <px-button v-has="'PRECURSOR_CHEMICALS_DETAIL'" link type="primary" @click="handleDetail(scope.row.id)">
            <px-tooltip class="box-item" content="详情" placement="top">
              <px-icon><Tickets /></px-icon> </px-tooltip
          ></px-button>
          <px-button
            v-if="scope.row.status != 'INVALID'"
            v-has="'PRECURSOR_CHEMICALS_EDITOR'"
            link
            type="primary"
            @click="handleEditor(scope.row.id)"
          >
            <px-tooltip class="box-item" content="编辑" placement="top">
              <px-icon><EditPen /></px-icon> </px-tooltip
          ></px-button>
          <px-button v-if="scope.row.status != 'INVALID'" v-has="'PRECURSOR_CHEMICALS_DELETE'" link type="danger" @click="handleDelete(scope.row)"
            ><px-tooltip class="box-item" content="删除" placement="top">
              <px-icon><Delete /></px-icon> </px-tooltip
          ></px-button>
        </template>
      </px-table-column>
      <template #empty>
        <px-empty :image-size="150" />
      </template>
    </px-table>

    <pagination
      v-if="!equipopen && !equipopenDetail"
      v-show="total > 0"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      style="margin-bottom: -10px"
      :total="total"
      @pagination="getList"
    />

    <!-- 添加或修改参数配置对话框 -->

    <px-scrollbar v-if="equipopen" class="editorEquip">
      <px-button style="margin-left: 24px" type="primary" :icon="ArrowLeft" @click="cancel">返回</px-button>
      <div class="px-descriptions__title" style="margin: 20px 0 0 20px">基本信息</div>
      <px-row style="padding: 20px">
        <px-col :span="24">
          <px-descriptions class="margin-top" :column="3" border>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">系统:</div>
              </template>
              {{ equipdata.systemName }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">化学品名称:</div>
              </template>
              {{ equipdata.chemical }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">供应厂商:</div>
              </template>
              {{ equipdata.salesCompany }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">需要数量:</div>
              </template>
              {{ equipdata.needQuantity }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">单位:</div>
              </template>
              {{ equipdata.chemicalUnit }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">到厂日期:</div>
              </template>
              {{ equipdata.supplierArriveTime }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">存储地点:</div>
              </template>
              {{ equipdata.storageLocation }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">化学品特性:</div>
              </template>
              {{ equipdata.characteristics }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">载进日期:</div>
              </template>
              {{ equipdata.inboundDateFrom }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">槽车车号:</div>
              </template>
              {{ equipdata.truckNumber }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">司机姓名:</div>
              </template>
              {{ equipdata.driverName }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">比重:</div>
              </template>
              {{ equipdata.specificWeight }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">计收总量:</div>
              </template>
              {{ equipdata.purchaseQuantity }}KG
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">厂商负责人:</div>
              </template>
              {{ equipdata.supplierName }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">载进时间:</div>
              </template>
              {{ equipdata.inboundTimeFrom }}-{{ equipdata.inboundTimeTo }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">检查人:</div>
              </template>
              {{ equipdata.responsiblePerson }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">载入前液位:</div>
              </template>
              {{ equipdata.liquidLevelBefore }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">载入后液位:</div>
              </template>
              {{ equipdata.liquidLevelAfter }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">PO:</div>
              </template>
              {{ equipdata.poOrderNumber }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">PO已收货物量:</div>
              </template>
              {{ equipdata.usedQuantity }}
            </px-descriptions-item>
            <px-descriptions-item>
              <template #label>
                <div class="cell-item">PO剩余收货数量:</div>
              </template>
              {{ equipdata.remainQuantity }}
            </px-descriptions-item>
          </px-descriptions>
        </px-col>
      </px-row>
      <div style="width: 100%; padding: 0 0 0 20px; clear: both">
        <div class="px-descriptions__title" style="padding: 20px 0">检查核对事项</div>
        <div v-for="(item, index) in equipdata.checkResult.group" :key="index" class="info-form-content">
          <modelTitle :title="item.checkStep" style="margin: 16px 0" />
          <px-table :data="item.details" show-overflow-tooltip border style="width: 100%">
            <px-table-column type="index" width="60" label="序号" />
            <px-table-column prop="content" label="检查项" />
            <px-table-column label="检查结果" align="center">
              <template #default="scope">
                <px-radio-group v-model="scope.row.label" class="ml-4">
                  <px-radio v-for="item in scope.row.options" :key="item.label" :label="item.label" size="large">{{ item.label }}</px-radio>
                </px-radio-group>
              </template>
            </px-table-column>
            <px-table-column label="要求图片">
              <template #default="scope">
                <span>{{ scope.row.needPicture != "N" ? scope.row.pictureName : "-" }}</span>
              </template>
            </px-table-column>
            <px-table-column label="图片">
              <template #default="scope">
                <PhotoUploadchem v-if="scope.row.updatePictures != null" photoType="view" :photoList2="scope.row.updatePictures" />
                <span v-else>-</span>
              </template>
            </px-table-column>
            <px-table-column label="AI图像识别结果">
              <template #default="scope">
                <span style="float: left; margin-right: 10px">{{ scope.row.aiRecognitionResult ? scope.row.aiRecognitionResult : "-" }}</span>
                <PhotoUploadchem
                  v-if="scope.row.aiPictureUrls != null"
                  photoType="view"
                  :photoList2="
                    scope.row.aiPictureUrls.map(item => {
                      return {
                        url: item
                      };
                    })
                  "
                />
              </template>
            </px-table-column>
          </px-table>
        </div>
      </div>
      <div style="width: 100%; padding: 0 0 0 20px; clear: both">
        <div class="px-descriptions__title" style="padding: 20px 0">过磅照片</div>
        <PhotoUpload photoType="view" :photoData="{ moduleName: 'GENERAL_CHEMICALS' }" :photoList="equipdata.weighingFile" />
      </div>
      <div style="width: 100%; padding: 0 0 0 20px; clear: both">
        <div class="px-descriptions__title" style="padding: 20px 0">送货单</div>
        <PhotoUpload photoType="view" :photoData="{ moduleName: 'GENERAL_CHEMICALS' }" :photoList="equipdata.deliveryFile" />
      </div>
      <div style="width: 100%; padding: 0 0 0 20px; clear: both">
        <div class="px-descriptions__title" style="padding: 20px 0">比重照片</div>
        <PhotoUpload photoType="view" :photoData="{ moduleName: 'GENERAL_CHEMICALS' }" :photoList="equipdata.specificWeightPhoto" />
      </div>
      <div style="width: 100%; padding: 0 20px 20px; clear: both">
        <div class="px-descriptions__title" style="padding: 20px 0">检测报告</div>
        <FileUpload fileType="view" :fileData="{ moduleName: 'GENERAL_CHEMICALS' }" :fileList="equipdata.testingFile" />
      </div>
    </px-scrollbar>
    <px-scrollbar v-if="equipopenDetail" class="addEquip">
      <px-button style="margin-left: 24px" type="primary" :icon="ArrowLeft" @click="equipopenDetailcancel">返回</px-button>
      <px-steps :active="active" finish-status="success" style="width: 300px; margin: 0 auto; margin-top: 10px">
        <px-step title="联系厂商" />
        <px-step title="现场载进" />
      </px-steps>
      <px-form
        ref="detailruleFormRef"
        :disabled="fromdisable"
        :rules="active == 0 ? rules0 : rules"
        :model="equipdata"
        :inline="true"
        class="demo-form-inline"
        label-width="160px"
      >
        <div v-if="active == 0">
          <div
            class="box-card1"
            :style="{
              height: changshangFlg == true ? '' : '42px'
            }"
          >
            <div class="card-header" @click="setchangshangFlg()">
              <div class="card-title">载进前联系厂商</div>
              <div class="card-main">
                <px-icon v-if="!changshangFlg"><ArrowDown /></px-icon>
                <px-icon v-else><ArrowUp /></px-icon>
              </div>
            </div>
            <div class="form-div">
              <px-row>
                <px-col :span="8">
                  <px-form-item label="系统" prop="systemCode">
                    <px-select
                      v-model="equipdata.systemCode"
                      placeholder="请选择系统"
                      clearable
                      style="width: calc(100% - 100px)"
                      filterable
                      @change="setSystemChemicals"
                    >
                      <px-option v-for="dict in liquidList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemValue" />
                    </px-select>
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="化学品名称" prop="chemicalDictCode">
                    <px-select
                      v-model="equipdata.chemicalDictCode"
                      :disabled="buttonTitle == '编辑'"
                      placeholder="请选择化学品名称"
                      clearable
                      style="width: calc(100% - 100px)"
                      filterable
                      @change="setchemicalDictCode"
                    >
                      <px-option v-for="dict in chemicalList" :key="dict.id" :label="dict.itemName" :value="dict.itemValue" />
                    </px-select>
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="供应厂商" prop="salesCompany">
                    <px-select v-model="equipdata.salesCompany" placeholder="请选择系统" clearable style="width: calc(100% - 100px)" filterable>
                      <px-option v-for="dict in salesCompanyList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemName" />
                    </px-select> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="需要数量" prop="needQuantity">
                    <px-input v-model="equipdata.needQuantity" placeholder="请输入" clearable /> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="单位" prop="chemicalUnit">
                    <px-select v-model="equipdata.chemicalUnit" placeholder="请选择" clearable style="width: calc(100% - 100px)" filterable>
                      <px-option v-for="dict in unitList" :key="dict.id" :label="dict.itemName" :value="dict.itemName" />
                    </px-select>
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="到厂日期" prop="supplierArriveTime">
                    <px-date-picker
                      v-model="equipdata.supplierArriveTime"
                      value-format="YYYY-MM-DD HH:mm:ss"
                      style="width: calc(100% - 100px)"
                      type="datetime"
                      @change="settime"
                    /> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="PO">
                    <px-select
                      v-model="equipdata.poNumber"
                      placeholder="请选择"
                      clearable
                      style="width: calc(100% - 100px)"
                      filterable
                      @change="setponum"
                    >
                      <px-option v-for="dict in poList" :key="dict.poNumber" :label="dict.poOrderNumber" :value="dict.poNumber" />
                    </px-select>
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="PO已收货物量" disabled="true">
                    <px-input v-model="usedQuantity" disabled="true" placeholder="请输入" clearable /> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="PO剩余收货数量" disabled="true">
                    <px-input v-model="remainQuantity" disabled="true" placeholder="请输入" clearable /> </px-form-item
                ></px-col>
              </px-row>
            </div>
          </div>
        </div>
        <div v-if="active == 1">
          <div
            class="box-card1"
            :style="{
              height: jibenxinxiFlg == true ? '' : '42px'
            }"
          >
            <div class="card-header" @click="setqingdanFlg()">
              <div class="card-title">基本信息</div>
              <div class="card-main">
                <px-icon v-if="!jibenxinxiFlg"><ArrowDown /></px-icon>
                <px-icon v-else><ArrowUp /></px-icon>
              </div>
            </div>
            <div class="form-div">
              <px-row style="margin-bottom: 0">
                <px-col :span="8">
                  <px-form-item label="系统" prop="systemCode">
                    <px-select
                      v-model="equipdata.systemCode"
                      placeholder="请选择系统"
                      clearable
                      style="width: calc(100% - 100px)"
                      filterable
                      @change="setSystemChemicals"
                    >
                      <px-option v-for="dict in liquidList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemValue" />
                    </px-select>
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="存储地点" prop="storageLocation">
                    <px-select
                      v-model="equipdata.storageLocation"
                      placeholder="请输入存储地点"
                      clearable
                      style="width: calc(100% - 100px)"
                      filterable
                    >
                      <px-option v-for="dict in storeList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemName" />
                    </px-select>
                  </px-form-item>
                </px-col>
              </px-row>
              <px-row>
                <px-col :span="8">
                  <px-form-item label="化学品名称" prop="chemicalDictCode">
                    <px-select
                      v-model="equipdata.chemicalDictCode"
                      :disabled="buttonTitle == '编辑'"
                      placeholder="请选择化学品名称"
                      clearable
                      style="width: calc(100% - 100px)"
                      filterable
                      @change="setchemicalDictCode2"
                    >
                      <px-option v-for="dict in chemicalList" :key="dict.id" :label="dict.itemName" :value="dict.itemValue" />
                    </px-select>
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="化学品特性">
                    <px-input v-model="equipdata.characteristics" :disabled="buttonTitle == '编辑'" placeholder="请输入" clearable /> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="供应厂商" prop="salesCompany">
                    <px-select v-model="equipdata.salesCompany" placeholder="请选择系统" clearable style="width: calc(100% - 100px)" filterable>
                      <px-option v-for="dict in salesCompanyList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemName" />
                    </px-select> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="载进日期" prop="inboundDateFrom">
                    <px-date-picker
                      v-model="equipdata.inboundDateFrom"
                      value-format="YYYY-MM-DD"
                      style="width: calc(100% - 100px)"
                      type="date"
                      @change="settime"
                    /> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="槽车车号" prop="truckNumber">
                    <px-input v-model="equipdata.truckNumber" placeholder="请输入" clearable /> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="司机姓名"> <px-input v-model="equipdata.driverName" placeholder="请输入" clearable /> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="比重" prop="specificWeight">
                    <px-input v-model="equipdata.specificWeight" placeholder="请输入" clearable /> </px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="计收总量" prop="purchaseQuantity">
                    <px-input v-model="equipdata.purchaseQuantity" placeholder="请输入" clearable />Kg
                  </px-form-item></px-col
                >
                <px-col :span="8">
                  <px-form-item label="厂商负责人">
                    <px-input v-model="equipdata.supplierName" placeholder="请输入" clearable />
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="载进时间" style="width: calc(100% - 100px)" prop="timevalue">
                    <px-date-picker
                      v-model="equipdata.timevalue"
                      type="datetimerange"
                      start-placeholder="开始时间"
                      end-placeholder="结束时间"
                      format="YYYY-MM-DD HH:mm:ss"
                      value-format="YYYY-MM-DD HH:mm:ss"
                      :default-time="defaultTime" /></px-form-item
                ></px-col>
                <px-col :span="8">
                  <px-form-item label="检查人" prop="responsiblePersonId">
                    <px-select
                      v-model="equipdata.responsiblePersonId"
                      placeholder="请选择"
                      style="width: calc(100% - 100px)"
                      clearable
                      filterable
                      @change="changeresponsiblePerson"
                    >
                      <px-option v-for="item in userList" :key="item.value" :label="item.label" :value="item.value" />
                    </px-select>
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="载入前液位" prop="liquidLevelBefore">
                    <px-input v-model="equipdata.liquidLevelBefore" placeholder="请输入载入前液位" clearable />
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="载入后液位" prop="liquidLevelAfter">
                    <px-input v-model="equipdata.liquidLevelAfter" placeholder="请输入载入后液位" clearable />
                  </px-form-item>
                </px-col>
                <!-- <px-col :span="8">
                  <px-form-item label="入库单号" prop="externalInboundNumber">
                    <px-input v-model="equipdata.externalInboundNumber" placeholder="请输入入库单号" clearable />
                  </px-form-item>
                </px-col> -->

                <px-col :span="8">
                  <px-form-item label="购买证编号" prop="permitOutNumber">
                    <px-select
                      v-model="equipdata.permitOutNumber"
                      placeholder="请选择购买证编号"
                      clearable
                      style="width: calc(100% - 100px)"
                      filterable
                      @change="changepermitOutNumber"
                    >
                      <px-option v-for="dict in PermitList" :key="dict.permitOutNumber" :label="dict.permitOutNumber" :value="dict.permitOutNumber" />
                    </px-select>
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="购买证明有效期">
                    <px-input v-model="permitOutNumbertime" disabled placeholder="请输入" clearable />
                  </px-form-item>
                </px-col>
                <px-col :span="8">
                  <px-form-item label="剩余可购入数量（吨）">
                    <px-input v-model="permitOutNumbernum" disabled placeholder="请输入" clearable />
                  </px-form-item>
                </px-col>
              </px-row>
            </div>
          </div>
          <div
            class="box-card2"
            :style="{
              height: heduiFlg == true ? '' : '42px'
            }"
          >
            <div class="card-header" @click="setheduiFlg()">
              <div class="card-title">检查核对事项</div>
              <div class="card-main">
                <px-icon v-if="!heduiFlg"><ArrowDown /></px-icon>
                <px-icon v-else><ArrowUp /></px-icon>
              </div>
            </div>
            <px-scrollbar class="form-div">
              <div
                v-for="(item, index) in buttonTitle == '新增' ? checkItemList.group : equipdata.checkResult.group"
                :key="index"
                class="info-form-content"
              >
                <modelTitle :title="item.checkStep" style="margin: 16px 0" />
                <px-table :data="item.details" show-overflow-tooltip border style="width: 100%">
                  <px-table-column type="index" width="60" label="序号" />
                  <px-table-column prop="content" label="检查项" />
                  <px-table-column label="检查结果" align="center">
                    <template #default="scope">
                      <px-radio-group v-model="scope.row.label" class="ml-4">
                        <px-radio v-for="item in scope.row.options" :key="item.label" :label="item.label" size="large">{{ item.label }}</px-radio>
                      </px-radio-group>
                    </template>
                  </px-table-column>
                  <px-table-column label="要求图片">
                    <template #default="scope">
                      <span>{{ scope.row.needPicture != "N" ? scope.row.pictureName : "-" }}</span>
                    </template>
                  </px-table-column>
                  <px-table-column label="图片">
                    <template #default="scope">
                      <PhotoUploadchem
                        v-if="scope.row.needPicture != 'N'"
                        :key="scope.row.checkNumber"
                        photoType="add"
                        :photoList2="scope.row.updatePictures"
                        :row="scope.row"
                        @changePhotoList="changePhotoList"
                      />
                      <span v-else>-</span>
                    </template>
                  </px-table-column>
                  <px-table-column label="AI图像识别结果">
                    <template #default="scope">
                      <span style="float: left; margin-right: 10px">{{ scope.row.aiRecognitionResult ? scope.row.aiRecognitionResult : "-" }}</span>
                      <PhotoUploadchem
                        v-if="scope.row.aiPictureUrls != null"
                        photoType="view"
                        :photoList2="
                          scope.row.aiPictureUrls.map(item => {
                            return {
                              url: item
                            };
                          })
                        "
                      />
                    </template>
                  </px-table-column>
                </px-table>
              </div>
            </px-scrollbar>
          </div>
          <div
            class="box-card2"
            :style="{
              height: jiqicanshuFlg == true ? '' : '42px'
            }"
          >
            <div class="card-header" @click="setjiqicanshuFlg()">
              <div class="card-title">过磅单</div>
              <div class="card-main">
                <px-icon v-if="!jiqicanshuFlg"><ArrowDown /></px-icon>
                <px-icon v-else><ArrowUp /></px-icon>
              </div>
            </div>
            <px-scrollbar class="form-div">
              <div class="info-form-content">
                <PhotoUpload
                  :key="'ptoto1'"
                  photoType="add"
                  :photoData="{ moduleName: 'GENERAL_CHEMICALS' }"
                  :photoList="equipdata.weighingFile"
                  @changePhotoList="changePhotoList1"
                  @savePhotoStatus="savePhotoStatus1"
                />
              </div>
            </px-scrollbar>
          </div>
          <div
            class="box-card2"
            :style="{
              height: shebeitaizhangFlg == true ? '' : '42px'
            }"
          >
            <div class="card-header" @click="shebeitaizhangFlg()">
              <div class="card-title">送货单</div>
              <div class="card-main">
                <px-icon v-if="!shebeitaizhangFlg"><ArrowDown /></px-icon>
                <px-icon v-else><ArrowUp /></px-icon>
              </div>
            </div>
            <px-scrollbar class="form-div">
              <div class="info-form-content">
                <div class="deliveryFile">
                  <PhotoUpload
                    :key="'ptoto2'"
                    photoType="add"
                    :photoData="{ moduleName: 'GENERAL_CHEMICALS' }"
                    :photoList="equipdata.deliveryFile"
                    @changePhotoList="changePhotoList2"
                    @savePhotoStatus="savePhotoStatus2"
                  />
                </div>
              </div>
            </px-scrollbar>
          </div>
          <div
            class="box-card2"
            :style="{
              height: moxingshezhiFlg == true ? '' : '42px'
            }"
          >
            <div class="card-header" @click="setmoxingshezhiFlg()">
              <div class="card-title">比重照片</div>
              <div class="card-main">
                <px-icon v-if="!moxingshezhiFlg"><ArrowDown /></px-icon>
                <px-icon v-else><ArrowUp /></px-icon>
              </div>
            </div>
            <px-scrollbar class="form-div">
              <div class="info-form-content">
                <div class="specificWeightPhoto">
                  <PhotoUpload
                    :key="'ptoto3'"
                    photoType="add"
                    :photoData="{ moduleName: 'GENERAL_CHEMICALS' }"
                    :photoList="equipdata.specificWeightPhoto"
                    @changePhotoList="changePhotoList3"
                    @savePhotoStatus="savePhotoStatus3"
                  />
                </div>
              </div>
            </px-scrollbar>
          </div>
          <div
            class="box-card3"
            :style="{
              height: shebeitaizhangFlg == true ? '' : '42px'
            }"
          >
            <div class="card-header" @click="setshebeitaizhangFlg()">
              <div class="card-title">检测报告</div>
              <div class="card-main">
                <px-icon v-if="!shebeitaizhangFlg"><ArrowDown /></px-icon>
                <px-icon v-else><ArrowUp /></px-icon>
              </div>
            </div>
            <px-scrollbar class="form-div">
              <div class="info-form-content">
                <FileUpload
                  fileType="add"
                  :fileData="{ moduleName: 'GENERAL_CHEMICALS' }"
                  :fileList="equipdata.testingFile"
                  @changeFileList="changeFileList"
                  @saveFileStatus="saveFileStatus"
                />
              </div>
            </px-scrollbar>
          </div>
        </div>
      </px-form>
    </px-scrollbar>
    <div v-if="equipopenDetail" v-loading="subLoading" class="px-dialog-footer">
      <px-button @click="equipopenDetailcancel">取消</px-button>
      <px-button v-if="active == 0" type="primary" plain @click="next">下一步</px-button>
      <px-button v-if="active == 1" type="primary" plain @click="last">上一步</px-button>
      <px-button v-if="fromdisable" type="primary" @click="equipopenDetailcancel">关闭</px-button>
      <px-button v-else type="primary" :disabled="photoStatusFlag || fileStatusFlag" @click="equipopenDetailsubmitForm(detailruleFormRef)"
        >保存</px-button
      >
    </div>
    <px-dialog v-model="progressVisible" draggable clickHideContent title="易制毒化学品出库" width="800" align-center>
      <px-form ref="deliverFormRef" :rules="rules2" :model="deliverDate" :inline="true" class="demo-form-inline" label-width="110px">
        <px-row>
          <px-col :span="12">
            <px-form-item label="出库时间" prop="outboundTime">
              <px-date-picker
                v-model="deliverDate.outboundTime"
                style="width: calc(100% - 60px)"
                placeholder="请选择出库时间"
                type="datetime"
                format="YYYY-MM-DD HH:mm:ss"
                value-format="YYYY-MM-DD HH:mm:ss"
              />
            </px-form-item>
          </px-col>
          <px-col :span="12">
            <px-form-item label="出库数量" prop="outboundQuantity">
              <px-input-number
                v-model="deliverDate.outboundQuantity"
                placeholder="请输入出库数量"
                :min="0"
                controls-position="right"
                style="width: calc(100% - 60px)"
              />
            </px-form-item>
          </px-col>
        </px-row>
        <px-row>
          <px-col :span="12">
            <px-form-item label="领料单号(选填)">
              <px-input v-model="deliverDate.materialRequisitionNumber" placeholder="请输入领料单号" clearable style="width: calc(100% - 60px)" />
            </px-form-item>
          </px-col>
          <px-col :span="12">
            <px-form-item label="经办人" prop="operatorId">
              <px-select
                v-model="deliverDate.operatorId"
                placeholder="请选择"
                style="width: calc(100% - 100px)"
                clearable
                filterable
                @change="changeoperator"
              >
                <px-option v-for="item in userList" :key="item.value" :label="item.label" :value="item.value" />
              </px-select>
            </px-form-item>
          </px-col>
        </px-row>
      </px-form>
      <template #footer>
        <span class="dialog-footer">
          <px-button @click="progressVisible = false">取消</px-button>
          <px-button type="primary" @click="deliver(deliverFormRef)">确认</px-button>
        </span>
      </template>
    </px-dialog>
  </div>
</template>

<script setup name="Dict" lang="ts">
import Chuku from "@/assets/svg/chuku.svg?component";
import modelTitle from "@/views/common/components/modelTitle/index.vue";
// import useDictStore from '@/store/modules/dict'
defineOptions({
  name: "SystemDataDict"
});
// import { router } from "@/router";
import { userlistPage } from "@/api/waterQualityDetection";
import { ArrowLeft } from "@px-ui/icons-vue";
import { useRoute } from "vue-router";
import { PxMessage, PxMessageBox } from "px-ui";
import { getCurrentInstance, ref, toRefs, reactive, onMounted } from "vue";
import { getToken } from "@/utils/auth";
import PhotoUpload from "@/components/Upload/PhotoUpload.vue";
import PhotoUploadchem from "@/components/Upload/PhotoUploadchem.vue";
import FileUpload from "@/components/Upload/FileUpload.vue";
import { queryChildByTypeCodeAndItemValue, liquidFileDelete } from "@/api/waterClass";
import {
  precursorChemicalLoadqueryListPage,
  precursorChemicalLoadqueryDetail,
  precursorChemicalLoadadd,
  precursorChemicalLoaddelete,
  precursorChemicalLoadupdate,
  precursorChemicalLoadoutbound,
  precursorChemicalLoadquerySystemChemicals,
  precursorChemicalLoadqueryChemicalName,
  commonqueryScadaIntervalValue,
  precursorChemicalLoadqueryPurchaseLicense,
  precursorChemicalLoadqueryChemicalUseInfo,
  checkItemqueryList,
  precursorChemicalLoadqueryPurchasePermitList,
  precursorChemicalLoadqueryChemicalLoadTimeAndLevel,
  precursorChemicalLoadqueryChemicalPoDropDownList
} from "@/api/chemicals";
const active = ref(0);
const next = () => {
  active.value = 1;
  if (equipdata.value.chemicalDictCode != "") {
    getPurchasePermitList(equipdata.value.chemicalDictCode);
  }
};
const last = () => {
  active.value = 0;
};
const changshangFlg = ref(true);
const setchangshangFlg = () => {
  changshangFlg.value = !changshangFlg.value;
};
const queysetSystemChemicals = val => {
  precursorChemicalLoadqueryChemicalName({
    chemicalType: "CH02",
    systemCode: val
  }).then(res => {
    console.log(res);
    querychemicalList.value = res;
  });
};
const setcharacteristics = val => {
  console.log(val);
  let selectcharacteristics = chemicalList.value.filter(item => item.itemValue == val);
  console.log(JSON.parse(selectcharacteristics[0].itemDesc).tx);
  equipdata.value.characteristics = JSON.parse(selectcharacteristics[0].itemDesc).tx;
  getChemicalLoadTimeAndLevel();
};
const setchemicalDictCode = val => {
  console.log(val);
  getuseinfo(val);
  setcharacteristics(val);
  getChemicalLoadTimeAndLevel();
};
const settime = val => {
  getuseinfo(equipdata.value.chemicalDictCode);
};
const poList = ref([]);
const getuseinfo = chemical => {
  if (equipdata.value.supplierArriveTime) {
    precursorChemicalLoadqueryChemicalPoDropDownList({
      chemicalDictCode: chemical,
      date: `${equipdata.value.supplierArriveTime} 00:00:00`
    }).then(res => {
      console.log(res);
      poList.value = res.poDropDownList;
    });
  }
};
const setponum = val => {
  console.log(val);
  equipdata.value.poOrderNumber = poList.value.filter(item => item.poNumber == val)[0].poOrderNumber;
  precursorChemicalLoadqueryChemicalUseInfo({
    chemicalDictCode: equipdata.value.chemicalDictCode,
    date: `${equipdata.value.supplierArriveTime} 00:00:00`,
    selectedPoNumber: val
  }).then(res => {
    usedQuantity.value = res.usedQuantity != null ? res.usedQuantity : "未设置";
    remainQuantity.value = res.remainQuantity != null ? res.remainQuantity : "未设置";
  });
};
const setchemicalDictCode2 = val => {
  getPurchasePermitList(val);
  getChemicalLoadTimeAndLevel();
  setcharacteristics(val);
};
const getChemicalLoadTimeAndLevel = () => {
  precursorChemicalLoadqueryChemicalLoadTimeAndLevel({
    systemCode: equipdata.value.systemCode,
    chemicalDictCode: equipdata.value.chemicalDictCode
  }).then(res => {
    console.log(res);
    if (res?.liquidLevelBefore) {
      if (equipdata.value.liquidLevelBefore == "") {
        equipdata.value.liquidLevelBefore = res.liquidLevelBefore;
      }
    }
    if (res?.liquidLevelAfter) {
      if (equipdata.value.liquidLevelAfter == "") {
        equipdata.value.liquidLevelAfter = res.liquidLevelAfter;
      }
    }
  });
};
const getPurchasePermitList = chemicalDictCode => {
  precursorChemicalLoadqueryPurchasePermitList({
    chemicalDictCode: chemicalDictCode,
    updateId: equipdata.value.id
  }).then(res => {
    PermitList.value = res;
    if (res != null && res.length > 0) {
      equipdata.value.permitOutNumber = res[0].permitOutNumber;
      permitOutNumbernum.value = res[0].remainQuantity;
      permitOutNumbertime.value = `${res[0].effectiveDateFrom} - ${res[0].effectiveDateTo}`;
    } else {
      PxMessage({
        message: "选择的化学品购买证为空",
        type: "error"
      });
      equipdata.value.permitOutNumber = "";
      permitOutNumbertime.value = "";
      permitOutNumbernum.value = "";
    }
  });
};
const getPurchasePermitList2 = chemicalDictCode => {
  precursorChemicalLoadqueryPurchasePermitList({
    chemicalDictCode: chemicalDictCode,
    updateId: equipdata.value.id
  }).then(res => {
    PermitList.value = res;
  });
};
const setSystemChemicals = val => {
  liquidList.value.forEach(item => {
    if (item.itemValue == val) {
      console.log(item);
      equipdata.value.systemName = item.itemName;
    }
  });
  precursorChemicalLoadquerySystemChemicals({
    chemicalType: "CH02",
    systemCode: val
  }).then(res => {
    console.log(res);
    chemicalList.value = res;
    equipdata.value.chemicalDictCode = "";
  });
};

const jibenxinxiFlg = ref(true);
const heduiFlg = ref(true);
const setheduiFlg = () => {
  heduiFlg.value = !heduiFlg.value;
};
const defaultTime: [Date, Date] = [new Date(2000, 1, 1, 0, 0, 1), new Date(2000, 1, 1, 23, 59, 59)];
const setqingdanFlg = () => {
  jibenxinxiFlg.value = !jibenxinxiFlg.value;
};
const jiqicanshuFlg = ref(true);
const setjiqicanshuFlg = () => {
  jiqicanshuFlg.value = !jiqicanshuFlg.value;
};
const shebeitaizhangFlg = ref(true);
const setshebeitaizhangFlg = () => {
  shebeitaizhangFlg.value = !shebeitaizhangFlg.value;
};
const moxingshezhiFlg = ref(true);
const setmoxingshezhiFlg = () => {
  moxingshezhiFlg.value = !moxingshezhiFlg.value;
};
const setreceiveCompanyCode = val => {
  let setvalue = null;
  setvalue = liquidList.value.find(option => option.itemValue == val);
  if (setvalue && setvalue?.itemDesc != "") {
    queryParams.value.receiveCompanyCode = JSON.parse(setvalue.itemDesc).receiveCompanyCode;
  } else {
    queryParams.value.receiveCompanyCode = "";
  }
  //console.log(setvalue);
};

const deliver = async (formEl: any) => {
  if (!formEl) return;
  await formEl.validate(async valid => {
    if (valid) {
      const params = {
        id: deliverValue.value.id,
        documentNumber: deliverValue.value.documentNumber,
        outboundTime: deliverDate.value.outboundTime,
        outboundQuantity: deliverDate.value.outboundQuantity,
        materialRequisitionNumber: deliverDate.value.materialRequisitionNumber,
        operatorId: deliverDate.value.operatorId,
        operator: deliverDate.value.operator,
        updateTime: deliverValue.value.updateTime
      };
      precursorChemicalLoadoutbound(params).then((response: any) => {
        PxMessage({
          message: `出库成功`,
          type: "success"
        });
        resetQuery();
        progressVisible.value = false;
      });
    }
  });
};
const setAddreceiveCompanyCode = val => {
  let setvalue = null;
  setvalue = liquidList.value.find(option => option.itemValue == val);
  if (setvalue && setvalue.itemDesc != "") {
    equipdata.value.receiveCompanyCode = JSON.parse(setvalue.itemDesc).receiveCompanyCode;
  } else {
    // equipdata.value.receiveCompanyCode = "";
  }
  //console.log(setvalue);
};
const route = useRoute();
onMounted(() => {
  if (route.query.equipmentId) {
    handleDetail(route.query.equipmentId);
  }
});
const { proxy }: any = getCurrentInstance();

const typeList = ref([]);
const detailruleFormRef = ref();
const deliverFormRef = ref();
const progressVisible = ref(false);
const open = ref(false);
const equipopen = ref(false);
const equipopenDetail = ref(false);
const fromdisable = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const typeIdloading = ref(false);
const total = ref(0);
const progressPercent = ref(0);
const title = ref("");
const dateRange = ref([]);

// 图片是否上传完，是否可以保存
const savePhotoStatus1 = val => {
  console.log(val);
  photoStatusFlag.value = val;
};
const savePhotoStatus2 = val => {
  photoStatusFlag.value = val;
};
const savePhotoStatus3 = val => {
  photoStatusFlag.value = val;
};
const savePhotoStatus4 = val => {
  photoStatusFlag.value = val;
};
// 文件是否上传完，是否可以保存
const saveFileStatus = val => {
  fileStatusFlag.value = val;
};

const waterstatusList = [
  {
    value: "VALID",
    name: "全部"
  },
  {
    value: "INVALID",
    name: "已删除"
  }
];
const buttonTitle = ref("");
const data = reactive({
  liquidList: [],
  transportCompanyList: [],
  receiveCompanyList: [],
  typeIdList: [],
  categoryList: [],
  equipmentTypeList: [],
  positionList: [],
  equipmentDeptList: [],
  modelIdList: [],
  form: {},
  sellList: [],
  photoStatusFlag: false,
  fileStatusFlag: false,
  deliverDate: {
    outboundTime: "",
    outboundQuantity: "",
    materialRequisitionNumber: "",
    operatorId: "",
    operator: ""
  },
  deliverValue: {
    id: "",
    documentNumber: "",
    updateTime: ""
  },
  equipdata: {
    id: "",
    documentNumber: "",
    step: "",
    systemCode: "",
    systemName: "",
    salesCompany: "",
    chemicalDictCode: "",
    chemicalUnit: "",
    inboundDateFrom: "",
    inboundTimeFrom: "",
    inboundTimeTo: "",
    purchaseQuantity: "",
    externalInboundNumber: "",
    responsiblePersonId: "",
    responsiblePerson: "",
    storeKeeperId: "",
    storeKeeper: "",
    comment: "",
    liquidLevelBefore: "",
    liquidLevelAfter: "",
    testingFile: [],
    specificWeightPhoto: [],
    weighingFile: [],
    deliveryFile: [],
    needQuantity: "",
    supplierArriveTime: "",
    characteristics: "",
    truckNumber: "",
    driverName: "",
    supplierName: "",
    specificWeight: "",
    checkResult: {
      group: ""
    },
    checkVersion: "",
    permitOutNumber: "",
    storageLocation: "",
    timevalue: [],
    poOrderNumber: "",
    poNumber: ""
  },
  queryParams: {
    orderByColumn: "",
    isAsc: "",
    systemCode: "",
    systemName: "",
    chemicalDictCode: "",
    startTime: "",
    endTime: "",
    orderBy: "",
    pageNum: 1,
    pageSize: 20
  },
  rules0: {
    systemCode: [{ required: true, message: "系统不能为空", trigger: "blur" }],
    chemicalDictCode: [{ required: true, message: "化学品名称不能为空", trigger: "change" }],
    chemicalUnit: [{ required: true, message: "单位不能为空", trigger: "change" }],
    needQuantity: [{ required: true, message: "需要数量不能为空", trigger: "blur" }],
    salesCompany: [{ required: true, message: "供应厂商不能为空", trigger: "blur" }],
    poNumber: [{ required: true, message: "PO不能为空", trigger: "change" }],
    supplierArriveTime: [{ required: true, message: "到厂日期不能为空", trigger: "blur" }]
  },
  rules: {
    storageLocation: [{ required: true, message: "存储地点不能为空", trigger: "change" }],
    systemName: [{ required: true, message: "系统不能为空", trigger: "blur" }],
    systemCode: [{ required: true, message: "系统不能为空", trigger: "blur" }],
    salesCompany: [{ required: true, message: "供应厂商不能为空", trigger: "blur" }],
    chemicalDictCode: [{ required: true, message: "化学品名称不能为空", trigger: "change" }],
    inboundDateFrom: [{ required: true, message: "载进日期不能为空", trigger: "change" }],
    truckNumber: [{ required: true, message: "槽车车号不能为空", trigger: "blur" }],
    chemicalUnit: [{ required: true, message: "单位不能为空", trigger: "blur" }],
    inboundDate: [{ required: true, message: "入库日期不能为空", trigger: "change" }],
    purchaseQuantity: [{ required: true, message: "计收总量不能为空", trigger: "blur" }],
    specificWeight: [{ required: true, message: "比重不能为空", trigger: "blur" }],
    timevalue: [{ required: true, message: "载进时间不能为空", trigger: "change" }],
    useQuantity: [{ required: true, message: "使用数量不能为空", trigger: "blur" }],
    responsiblePersonId: [{ required: true, message: "检查人不能为空", trigger: "change" }],
    permitOutNumber: [{ required: true, message: "购买证编号不能为空", trigger: "change" }]
  },
  rules2: {
    outboundDate: [{ required: true, message: "出库时间不能为空", trigger: "change" }],
    outboundQuantity: [{ required: true, message: "出库数量不能为空", trigger: "blur" }],
    operatorId: [{ required: true, message: "经办人不能为空", trigger: "blur" }]
  },
  headers: {
    Authorization: "Bearer " + getToken().accessToken || ""
  },
  moduleName: "",
  dialogImageUrl: "",
  imageVisible: false,
  querychemicalList: [],
  chemicalList: [],
  unitList: [],
  userList: [],
  ScadaIntervalValue: {
    startTime: "",
    endTime: "",
    point: ""
  },
  usedQuantity: "",
  remainQuantity: "",
  checkItemList: [],
  storeList: [],
  PermitList: [],
  permitOutNumbertime: "",
  permitOutNumbernum: "",
  salesCompanyList: []
});

const {
  salesCompanyList,
  permitOutNumbertime,
  permitOutNumbernum,
  PermitList,
  storeList,
  checkItemList,
  usedQuantity,
  remainQuantity,
  ScadaIntervalValue,
  liquidList,
  transportCompanyList,
  receiveCompanyList,
  queryParams,
  form,
  rules0,
  rules,
  rules2,
  equipdata,
  deliverValue,
  typeIdList,
  equipmentTypeList,
  modelIdList,
  deliverDate,
  dialogImageUrl,
  imageVisible,
  photoStatusFlag,
  fileStatusFlag,
  sellList,
  querychemicalList,
  chemicalList,
  unitList,
  userList
} = toRefs(data);
const handleRemove = file => {
  equipdata.value.attachment = equipdata.value.attachment.filter(item => item !== file);
  let parmas = {
    fileId: file.fileId ? file.fileId : file?.response?.data?.fileId,
    ledgerCode: equipdata.value.ledgerCode
  };
  liquidFileDelete(parmas).then((response: any) => {
    // //console.log(response);
    PxMessage({
      type: "success",
      message: "删除成功"
    });
  });
};
const checkTime = () => {
  if (equipdata.value.manufactureDate && equipdata.value.warrantyEndDate) {
    if (equipdata.value.manufactureDate > equipdata.value.warrantyEndDate) {
      PxMessage({
        message: "开始时间不能大于结束时间",
        type: "error"
      });
    }
  }
};

const getScadaIntervalValue = val => {
  console.log(val);
  chemicalList.value.forEach(item => {
    if (item.itemValue == val) {
      console.log(JSON.parse(item.itemDesc).Tag);
      ScadaIntervalValue.value.point = JSON.parse(item.itemDesc).Tag;
      if (ScadaIntervalValue.value.point != "" && ScadaIntervalValue.value.startTime != "" && ScadaIntervalValue.value.endTime != "") {
        commonqueryScadaIntervalValue(ScadaIntervalValue.value).then(res => {
          console.log(res);
          equipdata.value.liquidLevelBefore = res.before;
          equipdata.value.liquidLevelAfter = res.after;
        });
      }
      precursorChemicalLoadqueryPurchaseLicense({
        chemical: item.itemName
      }).then(res => {
        console.log(res);
        equipdata.value.allowPurchaseQuantity = res.allowPurchaseQuantity;
        equipdata.value.purchaseProofNumber = res.purchaseProofNumber;
        usedQuantity.value = res.usedQuantity;
        equipdata.value.useDateFrom = [res.effectiveDateFrom, res.effectiveDateTo];
      });
      // equipdata.value.responsiblePerson = item.itemValue;
    }
  });
};

const getScadaIntervalValuetime = val => {
  console.log(val);
  ScadaIntervalValue.value.startTime = val[0];
  ScadaIntervalValue.value.endTime = val[1];
  if (ScadaIntervalValue.value.point != "" && ScadaIntervalValue.value.startTime != "" && ScadaIntervalValue.value.endTime != "") {
    commonqueryScadaIntervalValue(ScadaIntervalValue.value).then(res => {
      console.log(res);
      equipdata.value.liquidLevelBefore = res.before;
      equipdata.value.liquidLevelAfter = res.after;
    });
  }
};

const changepermitOutNumber = val => {
  PermitList.value.forEach(item => {
    if (item.permitOutNumber == val) {
      console.log(item);
      permitOutNumbernum.value = item.remainQuantity;
      permitOutNumbertime.value = `${item.effectiveDateFrom} - ${item.effectiveDateTo}`;
    }
  });
};

const changeresponsiblePerson = val => {
  userList.value.forEach(item => {
    if (item.value == val) {
      console.log(item);
      equipdata.value.responsiblePerson = item.label;
    }
  });
};

const changestoreKeeper = val => {
  userList.value.forEach(item => {
    if (item.value == val) {
      console.log(item);
      equipdata.value.storeKeeper = item.label;
    }
  });
};

const changeoperator = val => {
  userList.value.forEach(item => {
    if (item.value == val) {
      console.log(item);
      deliverDate.value.operator = item.label;
    }
  });
};

const getqueryCategoryList = () => {
  checkItemqueryList({
    type: "CHEMICAL_LOAD"
  }).then(res => {
    console.log(res);
    checkItemList.value = res;
  });
  userlistPage({ page: 1, pageSize: 9999, deptNameList: ["WATER"], status: 0 }).then((response: any) => {
    userList.value = response.data.map(item => ({ label: `${item.username}-${item.realName}`, value: item.userId }));
    console.log(response);
  });
  queryChildByTypeCodeAndItemValue({
    value: "WATER_CHEMICAL_SUPPLIER",
    typeCode: "WTTS"
  }).then((response: any) => {
    salesCompanyList.value = response;
  });
  queryChildByTypeCodeAndItemValue({
    value: "WATER_SYSTEM",
    typeCode: "WTTS"
  }).then((response: any) => {
    //console.log(response);
    liquidList.value = response;
  });
  //化学品单位
  queryChildByTypeCodeAndItemValue({
    value: "CHEMICAL_UNIT",
    typeCode: "WTTS"
  }).then((response: any) => {
    //console.log(response);
    unitList.value = response;
  });
  //运输单位
  queryChildByTypeCodeAndItemValue({
    value: "TU01",
    typeCode: "WTTS"
  }).then((response: any) => {
    //console.log(response);
    transportCompanyList.value = response;
  });
  //接收单位
  queryChildByTypeCodeAndItemValue({
    value: "RU01",
    typeCode: "WTTS"
  }).then((response: any) => {
    //console.log(response);
    receiveCompanyList.value = response;
  });
  //存储地点
  queryChildByTypeCodeAndItemValue({
    value: "SL01",
    typeCode: "WTTS"
  }).then((response: any) => {
    //console.log(response);
    storeList.value = response;
  });
  //销售单位
  queryChildByTypeCodeAndItemValue({
    value: "SU01",
    typeCode: "WTTS"
  }).then((response: any) => {
    //console.log(response);
    sellList.value = response;
  });
};
getqueryCategoryList();
function getList() {
  loading.value = true;
  if (dateRange.value != null) {
    queryParams.value.startTime = dateRange.value[0];
    queryParams.value.endTime = dateRange.value[1];
  } else {
    queryParams.value.startTime = "";
    queryParams.value.endTime = "";
  }

  precursorChemicalLoadqueryListPage(queryParams.value).then((response: any) => {
    typeList.value = response.data;
    total.value = response.total;
    loading.value = false;
  });
}
//出库
function formatDate(date) {
  const year = date.getFullYear();
  const month = (date.getMonth() + 1).toString().padStart(2, "0");
  const day = date.getDate().toString().padStart(2, "0");
  const h = date.getHours().toString().padStart(2, "0");
  const m = date.getMinutes().toString().padStart(2, "0");
  const s = date.getSeconds().toString().padStart(2, "0");
  return `${year}-${month}-${day} ${h}:${m}:${s}`;
}
const handleDelivery = val => {
  const start = new Date();
  start.setHours(0, 0, 0, 0);
  start.setTime(start.getTime());
  deliverDate.value = {
    outboundTime: formatDate(start),
    outboundQuantity: val.purchaseQuantity,
    materialRequisitionNumber: "",
    operatorId: JSON.parse(localStorage.getItem("userInfo")).userId,
    operator: `${JSON.parse(localStorage.getItem("userInfo")).username}-${JSON.parse(localStorage.getItem("userInfo")).realName}`
  };
  progressVisible.value = true;
  deliverValue.value = val;
  console.log(val);
};
/** 取消按钮 */
function cancel() {
  equipopen.value = false;
}
function equipopenDetailcancel() {
  equipopenDetail.value = false;
}
/** 表单重置 */
function reset() {
  form.value = {
    id: undefined,
    dictionaryName: undefined,
    dictionaryType: undefined,
    status: "VALID",
    remarks: undefined
  };
  proxy.resetForm("dictRef");
}
/** 搜索按钮操作 */
function handleQuery(type) {
  if (type == "search") {
    queryParams.value.pageNum = 1;
  }
  getList();
}
/** 重置按钮操作 */
function resetQuery() {
  queryParams.value = {
    pageNum: queryParams.value.pageNum,
    pageSize: queryParams.value.pageSize,
    orderByColumn: "",
    isAsc: "",
    systemCode: "",
    systemName: "",
    chemicalDictCode: "",
    startTime: "",
    endTime: "",
    orderBy: ""
  };
  dateRange.value = [];
  handleQuery("reset");
}

/** 新增按钮操作 */
function handleAdd() {
  active.value = 0;
  usedQuantity.value = "";
  remainQuantity.value = "";
  permitOutNumbertime.value = "";
  permitOutNumbernum.value = "";
  buttonTitle.value = "新增";
  jibenxinxiFlg.value = true;
  jiqicanshuFlg.value = true;
  shebeitaizhangFlg.value = true;
  moxingshezhiFlg.value = true;
  equipopenDetail.value = true;
  fromdisable.value = false;
  equipmentTypeList.value = [];
  modelIdList.value = [];
  equipdata.value = {
    id: "",
    documentNumber: "",
    step: "",
    systemCode: "",
    systemName: "",
    salesCompany: "",
    chemicalDictCode: "",
    chemicalUnit: "",
    inboundDateFrom: "",
    inboundTimeFrom: "",
    inboundTimeTo: "",
    purchaseQuantity: "",
    externalInboundNumber: "",
    responsiblePersonId: "",
    responsiblePerson: "",
    storeKeeperId: "",
    storeKeeper: "",
    comment: "",
    liquidLevelBefore: "",
    liquidLevelAfter: "",
    testingFile: [],
    specificWeightPhoto: [],
    weighingFile: [],
    deliveryFile: [],
    needQuantity: "",
    supplierArriveTime: "",
    characteristics: "",
    truckNumber: "",
    driverName: "",
    supplierName: "",
    specificWeight: "",
    checkResult: {},
    checkVersion: "",
    permitOutNumber: "",
    storageLocation: "",
    timevalue: [],
    poOrderNumber: "",
    poNumber: ""
  };
  PermitList.value = [];
  checkItemqueryList({
    type: "CHEMICAL_LOAD"
  }).then(res => {
    console.log(res);
    checkItemList.value = res;
  });
  const userInfo = localStorage.getItem("userInfo");
  // userId.value = JSON.parse(userInfo).userId;
}
const handleDetail = async val => {
  jibenxinxiFlg.value = true;
  jiqicanshuFlg.value = true;
  shebeitaizhangFlg.value = true;
  moxingshezhiFlg.value = true;
  const data = await precursorChemicalLoadqueryDetail({ id: val });
  //console.log(data);

  equipopen.value = true;
  // equipopenDetail.value = true;
  fromdisable.value = true;
  equipdata.value = data;
  if (data.responsiblePersonId != "") {
    equipdata.value.responsiblePersonId = Number(data.responsiblePersonId);
  }
  equipdata.value.timevalue = [data.useDateFrom, data.useDateTo];
  equipdata.value.checkResult.group = JSON.parse(data.checkResult.group);
  if (data?.weighingFile && data?.weighingFile.length > 0) {
    data?.weighingFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.weighingFile = data?.weighingFile;
  } else {
    equipdata.value.weighingFile = [];
  }
  if (data.deliveryFile && data.deliveryFile.length > 0) {
    data.deliveryFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.deliveryFile = data.deliveryFile;
    console.log(equipdata.value.deliveryFile);
  } else {
    equipdata.value.deliveryFile = [];
  }
  if (data.specificWeightPhoto && data.specificWeightPhoto.length > 0) {
    data.specificWeightPhoto.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.specificWeightPhoto = data.specificWeightPhoto;
  } else {
    equipdata.value.specificWeightPhoto = [];
  }
  if (data.testingFile && data.testingFile.length > 0) {
    data.testingFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.testingFile = data.testingFile;
  } else {
    equipdata.value.testingFile = [];
  }
};
const handleCopy = async val => {
  active.value = 0;
  buttonTitle.value = "新增";
  jibenxinxiFlg.value = true;
  jiqicanshuFlg.value = true;
  shebeitaizhangFlg.value = true;
  moxingshezhiFlg.value = true;

  const data = await precursorChemicalLoadqueryDetail({ id: val });
  // console.log(data);
  equipopenDetail.value = true;
  fromdisable.value = false;
  equipdata.value = data;
  getPurchasePermitList2(data.chemicalDictCode);
  getuseinfo(data.chemicalDictCode);
  if (data.responsiblePersonId != "") {
    equipdata.value.responsiblePersonId = Number(data.responsiblePersonId);
  }
  equipdata.value.timevalue = [data.inboundTimeFrom, data.inboundTimeTo];
  equipdata.value.checkResult.group = JSON.parse(data.checkResult.group);
  precursorChemicalLoadquerySystemChemicals({
    chemicalType: "CH02",
    systemCode: data.systemCode
  }).then(res => {
    console.log(res);
    chemicalList.value = res;
  });
  equipdata.value.useDateFrom = [data?.effectiveDateFrom, data?.effectiveDateTo];
  equipdata.value.useDateFrom2 = [data?.inboundTimeFrom, data?.inboundTimeTo];
  if (data?.weighingFile && data?.weighingFile.length > 0) {
    data?.weighingFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.weighingFile = data?.weighingFile;
  } else {
    equipdata.value.weighingFile = [];
  }
  if (data.deliveryFile && data.deliveryFile.length > 0) {
    data.deliveryFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.deliveryFile = data.deliveryFile;
    console.log(equipdata.value.deliveryFile);
  } else {
    equipdata.value.deliveryFile = [];
  }
  if (data.specificWeightPhoto && data.specificWeightPhoto.length > 0) {
    data.specificWeightPhoto.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.specificWeightPhoto = data.specificWeightPhoto;
  } else {
    equipdata.value.specificWeightPhoto = [];
  }
  if (data.testingFile && data.testingFile.length > 0) {
    data.testingFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.testingFile = data.testingFile;
  } else {
    equipdata.value.testingFile = [];
  }
  equipdata.value.supplierArriveTime = "";
  equipdata.value.inboundDateFrom = "";
  equipdata.value.timevalue = [];
};
const handleEditor = async val => {
  active.value = 0;
  buttonTitle.value = "编辑";
  jibenxinxiFlg.value = true;
  jiqicanshuFlg.value = true;
  shebeitaizhangFlg.value = true;
  moxingshezhiFlg.value = true;

  const data = await precursorChemicalLoadqueryDetail({ id: val });
  // console.log(data);
  equipopenDetail.value = true;
  fromdisable.value = false;
  equipdata.value = data;
  usedQuantity.value = data.usedQuantity;
  remainQuantity.value = data.remainQuantity;
  getPurchasePermitList2(data.chemicalDictCode);
  getuseinfo(data.chemicalDictCode);
  if (data.responsiblePersonId != "") {
    equipdata.value.responsiblePersonId = Number(data.responsiblePersonId);
  }
  equipdata.value.timevalue = [data.inboundTimeFrom, data.inboundTimeTo];
  equipdata.value.checkResult.group = JSON.parse(data.checkResult.group);
  precursorChemicalLoadquerySystemChemicals({
    chemicalType: "CH02",
    systemCode: data.systemCode
  }).then(res => {
    console.log(res);
    chemicalList.value = res;
  });
  equipdata.value.useDateFrom = [data?.effectiveDateFrom, data?.effectiveDateTo];
  equipdata.value.useDateFrom2 = [data?.inboundTimeFrom, data?.inboundTimeTo];
  if (data?.weighingFile && data?.weighingFile.length > 0) {
    data?.weighingFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.weighingFile = data?.weighingFile;
  } else {
    equipdata.value.weighingFile = [];
  }
  if (data.deliveryFile && data.deliveryFile.length > 0) {
    data.deliveryFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.deliveryFile = data.deliveryFile;
    console.log(equipdata.value.deliveryFile);
  } else {
    equipdata.value.deliveryFile = [];
  }
  if (data.specificWeightPhoto && data.specificWeightPhoto.length > 0) {
    data.specificWeightPhoto.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.specificWeightPhoto = data.specificWeightPhoto;
  } else {
    equipdata.value.specificWeightPhoto = [];
  }
  if (data.testingFile && data.testingFile.length > 0) {
    data.testingFile.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.testingFile = data.testingFile;
  } else {
    equipdata.value.testingFile = [];
  }
  setTimeout(() => {
    setcharacteristics(data.chemicalDictCode);
    getuseinfo(data.chemicalDictCode);
  }, 500);
};
/** 多选框选中数据 */
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}
// 新的图片列表

// 新的图片列表
const changePhotoList1 = val => {
  equipdata.value.weighingFile = val;
};
const changePhotoList2 = val => {
  equipdata.value.deliveryFile = val;
};
const changePhotoList3 = val => {
  equipdata.value.specificWeightPhoto = val;
};
// 新的文件列表
const changeFileList = val => {
  equipdata.value.testingFile = val;
};
const changePhotoList = (val, row) => {
  if (row) {
    console.log(val, row);
    row.updatePictures = val.map(item => (item?.response?.data ? item?.response?.data : item));
    console.log(row.updatePictures);
    row.aiRecognitionUid = Date.now();
    console.log(row.aiRecognitionUid);
  }
};
/** 提交按钮 */
const subLoading = ref(false);
const equipopenDetailsubmitForm = async (formEl: any) => {
  if (!formEl) return;
  await formEl.validate(async valid => {
    if (valid) {
      subLoading.value = true;
      const params = {
        id: equipdata.value.id,
        step: active.value == 0 ? "contact" : "load",
        storageLocation: equipdata.value.storageLocation,
        systemCode: equipdata.value.systemCode,
        systemName: equipdata.value.systemName,
        salesCompany: equipdata.value.salesCompany,
        chemicalDictCode: equipdata.value.chemicalDictCode,
        chemicalUnit: equipdata.value.chemicalUnit,
        inboundDateFrom: equipdata.value.inboundDateFrom,
        inboundTimeFrom: equipdata.value.timevalue[0],
        inboundTimeTo: equipdata.value.timevalue[1],
        purchaseQuantity: equipdata.value.purchaseQuantity,
        useQuantity: equipdata.value.useQuantity,
        responsiblePersonId: equipdata.value.responsiblePersonId,
        responsiblePerson: equipdata.value.responsiblePerson,
        liquidLevelBefore: equipdata.value.liquidLevelBefore,
        liquidLevelAfter: equipdata.value.liquidLevelAfter,
        weighingFile: equipdata.value.weighingFile,
        deliveryFile: equipdata.value.deliveryFile,
        specificWeightPhoto: equipdata.value.specificWeightPhoto,
        testingFile: equipdata.value.testingFile,
        needQuantity: equipdata.value.needQuantity,
        supplierArriveTime: equipdata.value.supplierArriveTime,
        characteristics: equipdata.value.characteristics,
        truckNumber: equipdata.value.truckNumber,
        driverName: equipdata.value.driverName,
        supplierName: equipdata.value.supplierName,
        specificWeight: equipdata.value.specificWeight,
        checkResult: { group: "" },
        checkVersion: "",
        documentNumber: equipdata.value.documentNumber,
        updateTime: equipdata.value.updateTime,
        permitOutNumber: equipdata.value.permitOutNumber,
        externalInboundNumber: equipdata.value.externalInboundNumber,
        poOrderNumber: equipdata.value.poOrderNumber,
        poNumber: equipdata.value.poNumber,
        usedQuantity: usedQuantity.value,
        remainQuantity: remainQuantity.value
      };
      if (buttonTitle.value == "新增") {
        params.checkResult.group = JSON.stringify(checkItemList.value.group);
        params.checkVersion = checkItemList.value.checkVersion;
        if (params.weighingFile.length > 0) {
          params.weighingFile = params.weighingFile.map(item => (item?.response?.data ? item?.response?.data.id : item.id));
        }
        if (params.deliveryFile.length > 0) {
          params.deliveryFile = params.deliveryFile.map(item => (item?.response?.data ? item?.response?.data.id : item.id));
        }
        if (params.specificWeightPhoto.length > 0) {
          params.specificWeightPhoto = params.specificWeightPhoto.map(item => (item?.response?.data ? item?.response?.data.id : item.id));
        }
        if (params.testingFile.length > 0) {
          params.testingFile = params.testingFile.map(item => (item?.response?.data ? item?.response?.data.id : item.id));
        }
        precursorChemicalLoadadd(params)
          .then((response: any) => {
            PxMessage({
              message: `${buttonTitle.value == "新增" ? "添加成功" : "修改成功"}`,
              type: "success"
            });
            resetQuery();
            subLoading.value = false;
            equipopenDetail.value = false;
          })
          .catch(() => {
            subLoading.value = false;
          });
      } else {
        params.checkResult.group = JSON.stringify(equipdata.value.checkResult.group);
        params.checkVersion = equipdata.value.checkVersion;
        if (params.weighingFile.length > 0) {
          params.weighingFile = params.weighingFile.map(item => (item?.response?.data ? item?.response?.data.id : item.id));
        }
        if (params.deliveryFile.length > 0) {
          params.deliveryFile = params.deliveryFile.map(item => (item?.response?.data ? item?.response?.data.id : item.id));
        }
        if (params.specificWeightPhoto.length > 0) {
          params.specificWeightPhoto = params.specificWeightPhoto.map(item => (item?.response?.data ? item?.response?.data.id : item.id));
        }
        if (params.testingFile.length > 0) {
          params.testingFile = params.testingFile.map(item => (item?.response?.data ? item?.response?.data.id : item.id));
        }
        precursorChemicalLoadupdate(params)
          .then((response: any) => {
            PxMessage({
              message: `${buttonTitle.value == "新增" ? "添加成功" : "修改成功"}`,
              type: "success"
            });
            resetQuery();
            subLoading.value = false;
            equipopenDetail.value = false;
          })
          .catch(() => {
            subLoading.value = false;
          });
      }
    }
  });
};
/** 删除按钮操作 */
function handleDelete(row) {
  //console.log(row);
  // const dictIds = [];
  // if (row.equipmentId != undefined) {
  //   dictIds.push(row.equipmentId);
  // } else {
  //   dictIds.push(...ids.value);
  // }
  PxMessageBox.confirm('是否确认删除"' + row.chemical + '"？', "温馨提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
    draggable: true
  })
    .then(async () => {
      const data = await precursorChemicalLoaddelete({ id: row.id });
      PxMessage({
        message: "删除成功",
        type: "success"
      });
      getList();
    })
    .catch(() => {});
}

const { VITE_FANRUAN_BASE_URL, VITE_SERVE_API_STATIC_URL } = import.meta.env;
/** 导出按钮操作 */
function handleExport() {
  if (dateRange.value != null && dateRange.value.length > 0) {
    let Token = getToken().accessToken || "";
    // proxy.download("post", "/operation/api/v1/water/testQuality/pwMetalImpurity/export", queryParams.value, "水质检测-纯水金属阴阳离子.xlsx");
    let url = `${VITE_FANRUAN_BASE_URL}/webroot/decision/view/report?viewlet=water%252F%25E6%2598%2593%25E5%2588%25B6%25E6%25AF%2592%25E5%258C%2596%25E5%25AD%25A6%25E5%2593%2581%25E8%25B4%25AD%25E4%25B9%25B0%25E5%258F%25B0%25E8%25B4%25A6.cpt&token=${Token}&from=${dateRange.value[0]}&to=${dateRange.value[1]}&location&format=excel&extype=simple&facCode=${localStorage.getItem("facCode") || ""}&apiHost=${VITE_SERVE_API_STATIC_URL}&__filename__=易制毒化学品入库台账`;
    window.location.href = url;
  } else {
    PxMessage({
      message: "请选择时间后再导出",
      type: "error"
    });
  }
}

getList();
</script>
<style scoped lang="scss">
.addEquip {
  position: absolute;
  top: 0;
  top: 5px;
  left: 0;
  width: calc(100% - 48px);
  height: calc(100% - 40px);
  margin: 24px;
  background: white;
}

.editorEquip {
  position: absolute;
  top: 0;
  top: 5px;
  left: 0;
  width: calc(100% - 48px);
  height: calc(100% - 40px);
  margin: 24px;
  background: white;
}

.px-dialog-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 2002;
  width: 100%;
  height: 50px;
  padding-top: 10px;
  padding-right: 34px;
  text-align: right;
  background: white;
  box-shadow: 0 0 10px 0 rgb(0 0 0 / 16%);
}

.card-header {
  min-height: 40px;
  padding: 14px 15px 7px !important;
  cursor: pointer;
  user-select: none;
  background: #e7eefb;
}

.card-title {
  float: left;
  line-height: 14px;
}

.card-main {
  float: left;
  margin: -3px 8px 0 5px;
  cursor: pointer;
}

.box-card1 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card2 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card3 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card4 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.demo-form-inline {
  .px-input {
    --px-input-width: calc(100% - 100px);
  }

  .px-form-item {
    width: 100%;
  }

  .px-textarea__inner {
    width: calc(100% - 100px) !important;
  }

  .px-form-item__label {
    font-weight: 400 !important;
  }
}

.form-div {
  padding: 24px;

  .px-row {
    margin-bottom: 16px;
  }
}

.px-icon {
  font-size: 16px !important;
}

:deep(.px-tabs__header) {
  // padding-left: 6px !important;
}

:deep(.px-tabs--top .px-tabs__item.is-top.is-active) {
  border: none;

  .pane-bottom {
    line-height: 30px;
    border-bottom: 2px solid #3b82f6;
  }
}

:deep(.px-tabs .px-tabs__item) {
  .pane-bottom {
    line-height: 30px;
  }
}

.pane-line {
  position: absolute;
  top: 12px;
  right: 0;
  height: 15px;
  color: #dcdcdc;
  border-left: 1px solid #dcdcdc;
}

:deep(.custom-form-ui .px-form-item) {
  width: 250px !important;
}

.filename {
  position: absolute;
  bottom: -30px;
  width: 96px;
  overflow: hidden;
  color: rgb(166 167 172);
  text-overflow: ellipsis;
  white-space: nowrap;
}

:deep(.px-descriptions__label.px-descriptions__cell.is-bordered-label) {
  width: 166px;
  background: #e7eefb;
  border: 1px solid #dfdfdf;
}

:deep(.px-descriptions__body .px-descriptions__table.is-bordered .px-descriptions__cell) {
  border: 1px solid #dfdfdf;
}

.cell-item {
  text-align: right;
}

:deep(.px-table__header) {
  thead {
    tr {
      background-color: #e7eefb !important;

      th {
        font-size: 14px;
        font-weight: bold;
        color: #000;
        background-color: #e7eefb !important;
      }
    }
  }
}

:deep(.px-table--isfixedHeader .px-table__header-wrapper .px-table-fixed-column--right) {
  background-color: #e7eefb !important;
}

.center2 {
  :deep(.px-descriptions__body) {
    table {
      border-left: none;

      .is-bordered-label {
        border-left: none !important;
      }
      // .is-bordered-content {
      //   border-right: none !important;
      // }
    }
  }
}

.center3 {
  :deep(.px-descriptions__body) {
    table {
      border-top: none;

      .is-bordered-label {
        border-top: none !important;
      }

      .is-bordered-content {
        border-top: none !important;
      }
    }
  }
}

:deep(.px-table) {
  td.px-table__cell,
  .px-table th.px-table__cell.is-leaf {
    position: revert;
  }
}
</style>
